﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using PropertyManagement.Core.Model;

namespace PropertyManagement.Core.DataAccess {
    public static partial class FeeUnitPriceManageDataAccess {
        public static FeeUnitPriceManage GetUnitByBillType(BillType type) {
            var sql = @"select * from dbo.FeeUnitPriceManage where IsExpire = 0 and BillType = @type ";
            var paramList = new[] {
                    new SqlParameter("type", (int)type)
                };
            using (var iReader = SqlServerHelper.ExecuteReader(SqlServerHelper.ConnectionString, CommandType.Text, sql,
                                                            paramList)) {
                if (iReader.Read( )) {
                    return CreationFeeUnitPriceManageByIReader(iReader);
                };
                return null;
            } 
        }
    }
}
